<?php


namespace app\common\task;

use app\bbs\model\BbsArticle;
use app\bbs\model\BbsArticleLabel;
use Lizhichao\Word\VicDict;
use Lizhichao\Word\VicWord;
use yunwuxin\cron\Task;

/**
 * 还原文章的权重
 */
class SyncArticleWeightTask extends Task
{
    public function configure() : void
    {
        $this->expression("*/1 * * * *"); //设置任务的周期，每天执行一次，更多的方法可以查看源代码，都有注释
    }

    protected function execute() : void
    {
        echo '开始更新文章的权重';
        $time = date('Y-m-d H:i:s', strtotime('- 1 day'));
        BbsArticle::build()
                  ->where('start_time', '<', $time)
                  ->save(['weight' => 0 ,'use_point' =>0]);
    }
}